Tighten up some tests
authorAlex Crichton <alex@alexcrichton.com>
Thu, 10 Jul 2014 19:08:13 +0000 (12:08 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 10 Jul 2014 19:08:13 +0000 (12:08 -0700)
tests/test_cargo_compile_path_deps.rs
tests/test_cargo_test.rs

index 3c6fa7c0d4e7e27e59b2388b8a5b89135921c29f..3b031301c6d22ff6d03ae50aacfadcf75ad24bd1 100644 (file)
@@ -97,32 +97,28 @@ test!(cargo_compile_with_root_dev_deps {
             [dev-dependencies.bar]
 
             version = "0.5.0"
-            path = "bar"
+            path = "../bar"
 
             [[bin]]
-
             name = "foo"
         "#)
-        .file("src/foo.rs",
-              main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
-        .file("bar/Cargo.toml", r#"
-            [project]
+        .file("src/main.rs",
+              main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice());
+    let p2 = project("bar")
+        .file("Cargo.toml", r#"
+            [package]
 
             name = "bar"
             version = "0.5.0"
             authors = ["wycats@example.com"]
-
-            [[lib]]
-
-            name = "bar"
         "#)
-        .file("bar/src/bar.rs", r#"
+        .file("src/lib.rs", r#"
             pub fn gimme() -> &'static str {
                 "zoidberg"
             }
-        "#)
-        ;
+        "#);
 
+    p2.build();
     assert_that(p.cargo_process("cargo-build"),
         execs().with_stdout(format!("{} bar v0.5.0 (file:{})\n\
                                      {} foo v0.5.0 (file:{})\n",
index 77f90feb5e9e2d98c8aa08935ce24b2b040e2eb0..ed3f488a4befb5626aa81a1e4e3a8518c605b0d6 100644 (file)
@@ -47,13 +47,36 @@ test!(test_with_lib_dep {
             version = "0.0.1"
             authors = []
         "#)
-        .file("src/lib.rs", "pub fn foo(){}")
+        .file("src/lib.rs", "
+            pub fn foo(){}
+            #[test] fn lib_test() {}
+        ")
         .file("src/main.rs", "
             extern crate foo;
+
             fn main() {}
+
+            #[test]
+            fn bin_test() {}
         ");
 
-    assert_that(p.cargo_process("cargo-test"), execs().with_status(0));
+    assert_that(p.cargo_process("cargo-test"),
+                execs().with_status(0)
+                       .with_stdout(format!("\
+{compiling} foo v0.0.1 (file:{dir})
+
+running 1 test
+test bin_test ... ok
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
+
+
+running 1 test
+test lib_test ... ok
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
+
+", compiling = COMPILING, dir = p.root().display()).as_slice()));
 })
 
 test!(test_with_deep_lib_dep {